var freeTry = document.getElementsByClassName('free--try')[0];
var dialogMask = document.getElementsByClassName('dialog--mask')[0];
var dialogContainer = document.getElementsByClassName('dialog--container')[0];
var dialogDel = document.getElementsByClassName('dialog--del')[0];
var freetryBtn = document.getElementsByClassName('free--try__btn')[0];
var navContainer = document.getElementsByClassName('nav--container')[0];
var navDetailed = document.getElementsByClassName('nav--product__detailed');
var navPic = document.getElementsByClassName('nav--pic')[0];
var contactPic = document.getElementsByClassName('contact--top__pic')[0];
var containerReplenish =document.getElementsByClassName('container__choice')[0];
var currentY = 0;
freeTry.onclick = function () {
    dialogMask.style.display = 'block';
    dialogContainer.style.display = 'block';
};
dialogDel.onclick = function () {
    dialogMask.style.display = 'none';
};
freetryBtn.onclick = function () {
    dialogMask.style.display = 'none';
};

window.onscroll = function () {
    currentY = document.documentElement.scrollTop;
    if(currentY >= 60 && currentY < 360){
        for(var i = 0; i < navDetailed.length; i++){
            navDetailed[i].style.color = "#434242";
        }
        containerReplenish.style.position = 'unset';
        navContainer.style.position = 'fixed';
        navContainer.style.backgroundColor = '#fff';
        navPic.src ='../img/first_images/iphone_logo.png';
    }
    if(currentY >= 360){
        containerReplenish.style.position = 'fixed';
        navContainer.style.position = 'absolute';
        containerReplenish.style.top = 0;
        containerReplenish.style.left = 0;
    }
    if(currentY === 0){
        navContainer.style.position = 'fixed';
        for(var i =0; i < navDetailed.length; i++){
            navDetailed[i].style.color = "#fff";
        }
        navPic.src ='../img/first_images/145x45baise.png';
        navContainer.style.backgroundColor = 'unset';
    }
};

